import requests,redis
from loguru import logger
from flask import Flask,jsonify,request
import datetime
from sql_util import *
import re
from conf import *
import tldextract
import json

logger.add("warns.log", level="INFO")
redis_config =   {
        "redis_host": "r-bp1e8lecdfhttng2pbpd.redis.rds.aliyuncs.com",
        "redis_port": 6999,
        "redis_db": 5,
        "redis_password": "redis123@"
    }

pool = redis.ConnectionPool(
    host=redis_config['redis_host'],
    port=int(redis_config["redis_port"]),
    db=int(redis_config['redis_db']),
    password=redis_config['redis_password'],
    encoding='utf8',
    decode_responses=True)
r = redis.Redis(connection_pool=pool)

app = Flask(__name__)

accept_list=['cdn.refersion.com', 'http://www.clarity.ms', 'bat.bing.com', 'http://www.googletagmanager.com', 'connect.facebook.net', 'yoast.com', 'fonts.googleapis.com', 'gentlebands.com', 'schema.org', 'd24r3siuq13q9r.cloudfront.net', 'http://www.dwin1.com', 'api.w.org', 'wordpress.org', 'http://www.facebook.com', 'mens-weddingbands.com', 'prodemo.woostify.com', 'mirror.longpean.com', 'static.hotjar.com', 'gmpg.org', 'googleads.g.doubleclick.net', 'client.relay.crisp.chat', 'client.crisp.chat', 'static-tracking.klaviyo.com', 'static.klaviyo.com', 'script.hotjar.com', 'codex.wordpress.org', 'yoa.st', 'search.google.com', 'http://www.zippy.co.uk', 'developers.pinterest.com', 'http://www.google.com', 'docs.wp-rocket.me', 'wp-rocket.me', 'secure.gravatar.com', 'http://www.w3.org', 'd25trxery91118.cloudfront.net', 'http://www.instagram.com', 'http://www.pinterest.com', 'http://www.youtube.com', 'pub-ab7859fbebc7c051b4ca.tracking.refersion.com','www.googletagmanager.com', 'www.clarity.ms', 'www.google-analytics.com', 'www.dwin1.com', 'www.facebook.com', 'www.w3.org', 'm.media-amazon.com', 'www.instagram.com', 'www.pinterest.com', 'www.youtube.com', 'gum.criteo.com','sslwidget.criteo.com','td.doubleclick.net','images-na.ssl-images-amazon.com']

def return_msg(suc,msg,data):
    return jsonify({
            "success": suc,
            "errorCode": 200 if suc else 500,
            "errorStr": msg,
            "data":data
        })

def getDomain(url):
    val = tldextract.extract(url)
    return val.fqdn

def match_domain(string):
    # pattern = r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'

    # pattern = r'((?:https?)://[\S\.][^\"\']?\S[^\"\']+)'
    m=[]
    pattern = r'((?:https?)://[\S\.][^\"\']?\S[^\"\'\>]+)'
    matches = re.findall(pattern, string)
    pattern_domain = r'https?://(\S[^\/]+)'
    for match in matches:
        m2 = re.findall(pattern_domain, match)
        m.append(m2)

    return m


def send_dingtalk(message, ats):
    # 构造POST请求的payload
    payload = {
        'msgtype': 'text',
        'text': {'content': message}
    }

    if not ats:
        payload['at'] = {"isAtAll" : False, 'atMobiles' : ats}

    try:
        logger.info(f"[warn]:{message}")
        # response = requests.post(webhook_url, json=payload)
        # if hasattr(response, 'errorcode'):
        #     logger.info("消息发送失败:", response.errmsg)
        # else:
        #     logger.info("发送消息返回", response.content)
        # if response.status_code == 200:
        #     print("成功发送钉钉通知")
        # else:
        #     print("发送钉钉通知失败")

    except Exception as e:
        print("发送钉钉通知时出现错误:", str(e))

@app.route("/saveRecord",methods=['POST'])
def getCarConfig():
    content=request.json.get("c")
    cookie_str = request.json.get("ck")
    session_str = request.json.get("ss")
    url_str=request.json.get("url")
    ua_str = request.json.get("ua")
    ip_str = request.json.get("ip")
    if not content or not cookie_str or not session_str:
        return return_msg(0,"参数错误",None), 200
    
    now = datetime.datetime.now()
    date = str(datetime.datetime.strftime(now - datetime.timedelta(days=0), '%Y-%m-%d %H:%M:%S'))

    #解析域名
    result = match_domain(content)

    field_name = ('content_str','cookie_str','session_str','all_domain','url_str','ua_str','ip_str','create_time')
    final_list = []
    dada = (str(content),str(cookie_str),str(session_str),str(result),str(url_str),str(ua_str),str(ip_str),date)
    final_list.append(dada)
    insert_id = 0
    if len(final_list)>0:
        # logger.info("插入{}条数据{}", len(final_list), final_list)
        insert_id = insert('t_dlz_access_records_two', field_name, final_list)

    if len(result)>0:
        black_list = []
        # 判断，发送消息
        for x in result:
            for yy in x:
                xx=getDomain(yy)
                if len(xx)>0 and xx not in accept_list and xx not in black_list:
                    black_list.append(yy)

        if len(black_list)>0:
            send_dingtalk(f"[{insert_id}]不在白名单的域名=》" + str(black_list), False)
    if content[0:9]=='[a click]':
        send_dingtalk(f"[{insert_id}]跳转监控=》" + str(content), False)
    if content[0:15]=='[create script]':
        send_dingtalk(f"[{insert_id}]动态script新增=》" + str(content), ['13671516032'])
    return return_msg(1,"成功",""), 200

if __name__ == '__main__':
    # result=[['cdn.refersion.com'], ['bat.bing.com'], ['www.googletagmanager.com'], ['www.clarity.ms'], ['www.google-analytics.com'], ['www.google-analytics.com'], ['www.clarity.ms'], ['connect.facebook.net'], ['connect.facebook.net'], ['connect.facebook.net'], ['www.googletagmanager.com'], ['www.googletagmanager.com'], ['yoast.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['schema.org\\'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['fonts.googleapis.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['www.dwin1.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['api.w.org'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['wordpress.org'], ['connect.facebook.net'], ['www.facebook.com'], ['www.facebook.com'], ['gentlebands.com'], ['mens-weddingbands.com'], ['prodemo.woostify.com'], ['gentlebands.com'], ['mirror.longpean.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['mens-weddingbands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['mirror.longpean.com'], ['static.hotjar.com'], ['static.hotjar.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['www.clarity.ms'], ['connect.facebook.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gmpg.org'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['script.hotjar.com'], ['bat.bing.com'], ['googleads.g.doubleclick.net'], ['static-tracking.klaviyo.com'], ['static-tracking.klaviyo.com'], ['static.klaviyo.com'], ['static.klaviyo.com'], ['static.klaviyo.com'], ['static.klaviyo.com'], ['static.klaviyo.com'], ['client.relay.crisp.chat\\'], ['client.crisp.chat\\'], ['client.crisp.chat'], ['client.crisp.chat'], ['www.googletagmanager.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com\\'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com\\'], ['d24r3siuq13q9r.cloudfront.net'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com\\'], ['d24r3siuq13q9r.cloudfront.net'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['www.w3.org'], ['www.w3.org'], ['gentlebands.com'], ['gentlebands.com\\'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['m.media-amazon.com'], ['m.media-amazon.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d25trxery91118.cloudfront.net'], ['d25trxery91118.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['www.instagram.com'], ['www.pinterest.com'], ['www.youtube.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['www.instagram.com'], ['www.pinterest.com'], ['www.youtube.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com', 'gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['mens-weddingbands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['static.klaviyo.com'], ['www.facebook.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['client.crisp.chat'], ['gentlebands.com'], ['gentlebands.com'], ['gum.criteo.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['gentlebands.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['cdn.refersion.com'], ['gentlebands.com'], ['bat.bing.com'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['d24r3siuq13q9r.cloudfront.net'], ['www.facebook.com'], ['www.facebook.com']]
    # if len(result)>0:
    #     black_list = []
    #     # 判断，发送消息
    #     for x in result:
    #         for yy in x:
    #             xx = getDomain(yy)
    #             if len(xx)>0 and xx not in accept_list and xx not in black_list:
    #                 black_list.append(xx)
    #
    #     if len(black_list)>0:
    #         send_dingtalk("不在白名单的域名=》" + str(black_list))
    app.run(host='0.0.0.0', port=9098, debug=False)
